<?php 
require_once 'include.php';
$userInfo=getUserInfo();
?>
<html>
	<head>
		<meta charset="utf-8">
		<title>个人中心</title>
		<meta name="keywords" content="">
		<meta name="description" content="">
		<link rel="stylesheet" href="userindex/css/safe/ms-style.min.css" />
		<link rel="stylesheet" href="userindex/css/safe/personal_member.min.css" />
		<link rel="stylesheet" href="userindex/css/safe/Snaddress.min.css" />
		<script type="text/javascript" src="js/goodsdetail.js"></script>
		<script src="js/jquery-1.6.js" type="text/javascript"></script>
	</head>
	<body class="grey">
<?php include 'header.php';?>
<div id="" class="ng-top-banner"></div>
<div id="ms-center" class="personal-member">
			<div class="cont">
				<div class="cont-side">
					<div class="side-neck" style="margin-top: 20px;">
						<i></i>
					</div>
					<div class="ms-side" style="margin-top: 20px;">
						<article class="side-menu side-menu-off">
							<dl class="side-menu-tree" style="padding-left: 50px;">
								<dt><a href="userHome.php"><img src="userindex/img/user_icon2.png"  style="margin-right: 10px;margin-left: -20px;"/>
									个人中心</a></dt>
								<dd><a href="">修改资料</a></dd>
								<dd><a href="Address.php">收货地址</a></dd>
								<dt><img src="userindex/img/shoppingcart.png"  style="margin-right: 10px;margin-left: -20px;"/>我的购物车</dt>
								<dt><img src="userindex/img/file.png"  style="margin-right: 10px;margin-left: -20px;"/>订单管理</dt>
								<dd><a href="myorders.php">我的订单</a></dd>
							</dl>

							<a ison="on" class="switch-side-menu icon-up-side"><i></i></a>
						</article>
					</div>
				</div>
				<script>
			function showPassword(){
				var tabsContent = getClass('div','main-wrap'); 
				tabsContent[0].className = 'main-wrap mt15'; 
				}
			function changePassword(){
				var newPassword=document.getElementById('newPassword').value;
				var againPassword=document.getElementById('againPassword').value;
				if(!newPassword){alert("请输入“新密码”再提交");exit();}
				if(!againPassword){alert("请输入“确认密码”再提交");exit();}
				if(newPassword!=againPassword){alert("两次密码不一样");exit();}
				var url="doAction.php?act=changePassword";
				var data={"newPassword":newPassword};
				var success=function(response){
						if(response.errno==0){
							document.getElementById('newPassword').value="";
							document.getElementById('againPassword').value="";
							var tabsContent = getClass('div','main-wrap'); 
							tabsContent[0].className = 'main-wrap mt15 hide'; 
							alert("修改密码成功");
						}else{
							alert("修改失败，新密码与原密码相同");
						}
					}
				$.post(url,data,success,"json");
			}
			function changeFace(){
					var file=document.getElementById('myFace').value;
					if(file.value==''){
						alert('请选择要上传的头像文件');
						return false;
					}
					alert(file);
			}
		</script>
				<div class="cont-main">
				<div class="main-wrap mt15 changePassword hide">
						<h3>
	                        <strong>修改密码</strong>
	                    </h3>
						<div class="form-list tab-switch personal-wrap-show">
							<form>
								<div class="control-group clearfix">
									<label class="control-label">新密码：</label>
									<div class="controls lh26">
										<input style="margin-left: 10px;" type="password" class="text" id="newPassword">
									</div>
								</div>
								<div class="control-group clearfix">
									<label class="control-label">确认密码：</label>
									<div class="controls lh26">
										<input  style="margin-left: 10px;" type="password" class="text" id="againPassword">
									</div>
								</div>
								<div class="control-group clearfix priority-low">
									<label class="control-label">&nbsp;</label>
									<div style="float:left;">
										<a href="javascript:changePassword()"  class="ms-stand-btn1" >保 存</a>
									</div>
									<div id="" class="error-place"></div>
									<div class="error-place mt29"></div>
								</div>
							</form>
						</div>
					</div>
					
					<div class="main-wrap mt15">
						<h3>
	                        <strong>个人信息</strong>
	                    </h3>
	                    
						<div class="user-profile clearfix">
							<div class="user-profile-wrap">
								<div class="profile-avatar">
									<img src="uploads/<?php echo $userInfo['face']
									?>" height="120" width="120">
<!-- 									<div class="edit_bg"></div> -->
<!-- 									<a href="#">编辑头像</a> -->
								</div>
							</div>
							<div class="profile-info">
								<div class="control-group clearfix ">
									<div class="controls lh26">
										<label class="control-label"><span style="margin-left: 10px;">用户名:</span> 
											<span style="margin-left: 10px;"><?php echo $_SESSION['username']?></span></label>
									    <img src="userindex/img/success.png" />
									</div>
									<div class="controls lh26">
										<label class="control-label"><span style="margin-left: 10px;">
										<a href="javascript:showPassword()">修改密码</a></span> </label>
									</div>
								</div>
								<form method="post" enctype="multipart/form-data" action="doAction.php?act=changeFace" >
									<span style="margin-left: 10px;">修改头像:</span> <input type="file" name="myFace" required="required">
									<input type="submit" class="ms-stand-btn1" value="上传头像">
								</form>
							</div>
						</div>
						<form method="post" enctype="multipart/form-data" action="doAction.php?act=changeData" >
						<div class="form-list tab-switch personal-wrap-show">
							<div class="control-group clearfix">
								<label class="control-label">性别：</label>
								<div id="gender" class="controls">
									<label class="sex-label">
										<input type="radio" name="sex" value="1" <?php if($userInfo['sex']=='男')echo "checked='checked'";?>>
										<span>男</span>
									</label>
									<label class="sex-label">
										<input type="radio" name="sex" value="2"<?php if($userInfo['sex']=='女')echo "checked='checked'";?>>
										<span>女</span>
									</label>
									<label class="sex-label">
										<input type="radio" name="sex" value="3"<?php if($userInfo['sex']=='保密')echo "checked='checked'";?>>
										<span>保密</span>
									</label>
								</div>
							</div>
							<div class="control-group clearfix">
								<label class="control-label">邮箱：</label>
								<div class="controls lh26">
									<input  style="margin-left: 10px;" name="email" type="text" class="text" value="<?php echo $userInfo['email']?>">
								</div>
							</div>
								
							<div class="control-group clearfix priority-low">
								<label class="control-label">&nbsp;</label>
								<div style="float:left;">
									<input type="submit"  class="ms-stand-btn1" value="保 存">
								</div>
								<div id="" class="error-place"></div>
								<div class="error-place mt29"></div>
							</div>
						</div>
					</form>
					</div>
				</div>
				
				
			</div>
		</div>
		<div class="clear"></div>
		<div class="ng-footer">
			<textarea class="footer-dom" id="footer-dom-02">
			</textarea>
			<div class="ng-fix-bar"></div>
		</div>
		<style type="text/css">
			.ng-footer {
				height: 130px;
				margin-top: 0;
			}
			
			.ng-s-footer {
				height: 130px;
				background: none;
				text-align: center;
			}
			
			.ng-s-footer p.ng-url-list {
				height: 25px;
				line-height: 25px;
			}
			
			.ng-s-footer p.ng-url-list a {
				color: #666666;
			}
			
			.ng-s-footer p.ng-url-list a:hover {
				color: #f60;
			}
			
			.ng-s-footer .ng-authentication {
				float: none;
				margin: 0 auto;
				height: 25px;
				width: 990px;
				margin-top: 5px;
			}
			
			.ng-s-footer p.ng-copyright {
				float: none;
				width: 100%;
			}
			
			.root1200 .ng-s-footer p.ng-copyright {
				width: 100%;
			}
		</style>
		<?php include 'footer.php';?>
	</body>
</html>